# -*- encoding: utf-8 -*-
"""
@File    : homework.py
@Time    : 2020/11/9 19:58
@Author  : lluyao
@Email   : lluyao61@163.com
@Software: PyCharm
"""
'''
1、循环接收键盘输入的字符，判定是否属于正整数、负整数、浮点数 ，并给出相应提醒 按exit退出
'''
# import re
#
# while True:
#     msg = input('请输入需要验证的数字(按q退出)：')
#     if msg=='q':
#         break
#     elif re.findall(r'^[+]?[1-9]\d*$', msg):
#         print(f'{msg}是正整数')
#     elif re.findall(r'^-[1-9]\d*$', msg):
#         print(f'{msg}是负整数')
#     elif re.findall(r'^[-+]?[1-9]\d*\.\d*$|[0-9]\.\d*$', msg):
#         print(f'{msg}是浮点数')
#     else:
#         print('请输入合法数字')

'''
2、验证密码是否合法，密码要求8-10位，以（字母或者下划线开头），给出相应提示
'''
# import re
# pwd = input('please input your password:')
# if re.findall('^[A-z_]',pwd):
#     if re.findall('.{8,10}',pwd):
#         print('OK!')
#     else:
#         print('The password requires 8-10 bits')
# else:
#     print('The password needs to start with a letter or underscore')
'''
3、提取电话号码

'''
import re
tel = '''
wen tel: 17375722991
wen tel: 173-7572-2992
wen tel: 173 7572 2993
wen tel: (+86) 17375722994
wen tel: 173-75722--992
'''
result = re.findall(r'(?:\(\+\d{2}\)[ ]?)?\d{3}[\s-]?\d{4}[\s-]?\d{4}',tel)
print(result)